package com.gong.yuanma.io;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.TimeUnit;

/**
 * @author GongChang
 * @version 1.0
 * @date 2021/6/18 0018 15:19
 */
public class BioClient {

    public static void main(String[] args) {
        try {
            Socket socket = new Socket("127.0.0.1",8080);
            while (true){
                OutputStream outputStream = socket.getOutputStream();
                outputStream.write("hello world".getBytes());
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    outputStream.close();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
